<template>
	<view class="">
		<cu-custom isLeft isBack :bgColor="scrollTop>CustomBar?'header-bg-box' :''">
			<view slot="content" class="page_title">
				详情
			</view>
		</cu-custom>
		<view class="head_bg">
			<image src="https://qiyeji.oss-cn-beijing.aliyuncs.com/20250111/202501091838364301.png" mode="">
			</image>
		</view>
		<view class="box">
			<!-- <view class="head">
				<image :src="url" mode=""></image>
				<view class="head_right">
					<view class="text-cut">蓝雨桐</view>
					<view class="">购买人次 1088</view>
				</view>
			</view> -->

			<view class="box_shop">
				<view class="box_title">
					{{form.title}}
				</view>
				<view class="box_shop_title" v-if="form.items && form.items.length">
					<image src="https://qiyeji.oss-cn-beijing.aliyuncs.com/20250111/202501091827522416.png"
						mode=""></image>
					<view class="">
						关联宠物
					</view>
				</view>
				<view class="box_shop_list">
					<view @click="toPage(`/packagesA/pages/product/detail/index?id=${item1.bizId}`)"
						v-for="(item1,index1) in form.items" :key="index1" class="box_shop_list_item">
						<image :src="item1.picture" mode=""></image>
						<view class="shop_item_right">
							<view class="shop_item_name">
								{{item1.bizTitle}}
							</view>
							<view class="shop_item_price">
								￥<view class="">
									{{item1.price}}
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
			<view class="box_content">
				<!-- <view class="box_content_icon">
					<view class="">
						【摘要】
					</view>
					<view class="">
						2024新款东方韵味月饼🥮🥮🥮
					</view>
				</view> -->
				<view class="box_content_html" v-html="form.content"></view>
			</view>
		</view>
		<view style="width: 100%;height: 150rpx;">

		</view>
		<!-- <view class="bottom">
			<view class="bottom_wx">
				<image src="@/packagesC/static/order/wx.png" mode=""></image>
				<view class="">
					分享至微信
				</view>
			</view>
			<view class="bottom_btn">
				一键下单
			</view>
		</view> -->
	</view>
</template>

<script>
	import {
		detailLeaflet
	} from "@/api/pet/leaflet/index.js"
	import util from '@/common/util.js'
	export default {
		data(){
			return{
				CustomBar: this.CustomBar,
				scrollTop:0,
				form:{},
			}
		},
		onLoad(e) {
			if (e.id) {
				this.getDetail(e.id)
			}
		},
		onPageScroll(e) {
			this.scrollTop = e.scrollTop
		},
		methods: {
			toPage(url) {
				uni.navigateTo({
					url: url
				})
			},
			getDetail(id) {
				detailLeaflet({
					id: id
				}).then(res => {
					// common.css  img样式
					res.content = util.formatRichText(res.content)
					this.form = res
				})
			}
		}
	}
</script>
<style>
	page {
		background: #fff;
	}
</style>
<style lang="scss" scoped>
	.header-bg-box{
		background:  var(--primaryBg);
	}
	.page_title {
		font-family: PingFangSC, PingFang SC;
		font-weight: 600;
		font-size: 34rpx;
		color: var(--h1Color);
		line-height: 48rpx;
		white-space: nowrap;
	}

	.head_bg {
		width: 100%;
		height: 300rpx;
		position: absolute;
		top: 0;
		left: 0;
		z-index: -1;

		image {
			width: 100%;
			height: 100%;
		}
	}

	.box {
		margin-top: 24rpx;

		.head {
			width: 702rpx;
			height: 152rpx;
			margin: 0 auto 40rpx;
			background: linear-gradient(180deg, rgba(255, 255, 255, 0.8) 0%, #FAFAFA 100%);
			box-shadow: inset 0rpx 2rpx 0rpx 0rpx rgba(255, 255, 255, 0.5);
			border-radius: 14rpx;
			backdrop-filter: blur(20px);
			display: flex;
			align-items: center;
			padding: 0 32rpx;
			box-sizing: border-box;

			image {
				width: 72rpx;
				height: 72rpx;
				margin-right: 24rpx;
				border-radius: 4rpx;
			}

			.head_right {
				display: flex;
				flex-direction: column;

				view {
					&:first-child {
						font-family: PingFangSC, PingFang SC;
						font-weight: 600;
						font-size: 32rpx;
						color: var(--h1Color);
						line-height: 32rpx;
						margin-bottom: 16rpx;
					}

					&:last-child {
						font-family: PingFangSC, PingFang SC;
						font-weight: 400;
						font-size: 24rpx;
						color: var(--h3Color);
						line-height: 24rpx;
					}
				}
			}
		}

		.box_title {
			font-family: PingFangSC, PingFang SC;
			font-weight: 600;
			font-size: 34rpx;
			color: var(--h1Color);
			line-height: 50rpx;
			width: 702rpx;
			margin: 0 auto 24rpx;
		}

		.box_shop {
			// width: 100%;
			padding: 24rpx 20rpx;
			margin: 0 24rpx 40rpx;
			box-sizing: border-box;
			background: #F8F8F8;
			border-radius: 8rpx;

			.box_shop_title {
				display: flex;
				align-items: center;
				margin-bottom: 32rpx;

				image {
					width: 26rpx;
					height: 26rpx;
					margin-right: 12rpx;
				}

				view {
					font-family: PingFangSC, PingFang SC;
					font-weight: 400;
					font-size: 26rpx;
					color: var(--h1Color);
					line-height: 26rpx;
				}
			}

			.box_shop_list {
				width: 100%;

				.box_shop_list_item {
					background: #FFFFFF;
					border-radius: 8rpx;
					width: 100%;
					padding: 4rpx;
					box-sizing: border-box;
					margin-bottom: 16rpx;
					display: flex;

					&:last-child {
						margin-bottom: 0;
					}

					image {
						width: 160rpx;
						height: 160rpx;
						margin-right: 24rpx;
						border-radius: 8rpx;
					}

					.shop_item_right {
						display: flex;
						flex-direction: column;
						justify-content: space-between;
						flex: 1;
						padding: 16rpx 0 20rpx;

						.shop_item_name {
							font-family: PingFangSC, PingFang SC;
							font-weight: 400;
							font-size: 28rpx;
							color: var(--h1Color);
							line-height: 42rpx;
						}

						.shop_item_price {
							font-family: DINPro, DINPro;
							font-weight: 500;
							font-size: 26rpx;
							color: var(--primaryBg);
							line-height: 28rpx;
							display: inline-block;

							view {
								display: inline-block;
								font-size: 34rpx;
							}
						}
					}
				}
			}
		}

		.box_content {
			width: 100%;

			// border-top: 1rpx solid #eee;
			.box_content_icon {
				width: 702rpx;
				height: 96rpx;
				background: #FFFFFF;
				box-shadow: 0rpx 6rpx 20rpx 0rpx rgba(0, 0, 0, 0.04);
				border-radius: 8rpx;
				border: 1rpx solid #F8F8F8;
				margin: 33rpx auto;
				padding: 0 8rpx;
				box-sizing: border-box;
				display: flex;
				align-items: center;

				view {
					font-family: PingFangSC, PingFang SC;
					font-weight: 500;
					font-size: 28rpx;
					color: var(--h1Color);
					line-height: 40rpx;

					&:last-child {
						color: var(--h2Color);
					}
				}
			}

			.box_content_html {
				width: 702rpx;
				margin: 0 auto;
			}
		}
	}

	.bottom {
		width: 100%;
		background: #FFFFFF;
		box-shadow: 0rpx -1rpx 0rpx 0rpx #F6F6F6;
		padding: 12rpx 32rpx 50rpx;
		box-sizing: border-box;
		display: flex;
		align-items: center;
		justify-content: space-between;
		position: fixed;
		left: 0;
		bottom: 0;

		.bottom_wx {
			display: flex;
			flex-direction: column;
			align-items: center;

			image {
				width: 48rpx;
				height: 48rpx;
				margin-bottom: 8rpx;
			}

			view {
				font-family: PingFangSC, PingFang SC;
				font-weight: 400;
				font-size: 24rpx;
				color: var(--h1Color);
				line-height: 24rpx;
			}
		}

		.bottom_btn {
			width: 518rpx;
			background: var(--primaryGradBg);
			border-radius: 8rpx;
			font-family: PingFangSC, PingFang SC;
			font-weight: 600;
			font-size: 32rpx;
			color: #FFFFFF;
			line-height: 88rpx;
			text-align: center;
		}
	}
</style>